package com.qianxun.framework.common.util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author: huwei
 * @date: 2020/6/10 13:25
 * @version: 1.0.0
 */
public class ErrorUtil {

    public static String getErrorStackMessage(Throwable cause){
        ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
        cause.printStackTrace(new PrintWriter(baos));
        String result = baos.toString();
        try {
            baos.close();
        } catch (IOException e) {
            //ignore
        }
        return result;
    }
}
